<template>
    <div class="work-item">
        <h4>
            {{item.name}}
           <van-tag type="primary" v-if="item.checked=='1'?true:false">置顶</van-tag>
        </h4>
        <div>
            <van-image
            width="100"
            height="100"
            :src="item.logo[0].content"
            />

        </div>
        <div>
            <span>{{item.work}}</span>
            <span>{{item.lowMoney}}-{{item.higMoney}}</span>
        </div>
        <div>
            <span>{{item.area}} | {{item.years[0]}}年-{{item.years[1]}}年 |{{item.age[0]}}岁-{{item.age[1]}}岁   {{formTime(item.time)}}</span>
            <span>地址：{{item.address}}</span>
        </div>
        <button @click="del(index)">删除</button>
    </div>
</template>
<script>
import dayjs from 'dayjs'
import {useStore} from 'vuex'
export default {
    props:['item','index'],
    setup(props) {
        const {commit,state} = useStore()
        const formTime=(time)=>{
            return dayjs(time).format('YYYY-MM-DD:hh:mm:ss')
        }
        // 删除
        const del=(index)=>{
            commit('del',index)

        }
        return {formTime,del}
    }
}
</script>